#pragma once
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctype.h>
#include <sstream>
#include <math.h>
using namespace std;

class TextCalculator
{
	private:
		string userInput;
		string temporaryString;

	public:
		TextCalculator(void);
		~TextCalculator(void);

		void displayList(string);
			// Function to send the contents of a string to cout.

		string addSubtract(string);
			// Function to perform addition and subtraction operations
			// on the user-defined math expression.

		string multiplyDivide(string);
			// Function to perform multiplation and division operations
			// on the user-defined math expression.

		string parentheses(string);
			// Function to perform mathematical operations on the arguements
			// within parentheses.

		string exponents(string);
			// Function to perform exponent operations on the user-defined math expression.

		bool divideByZeroCheck(string);
			// Function that returns true if division by 0 occurs in multiplyDivide().

		bool divideByZeroParenthCheck(string);
			// Function that returns true if division by 0 occurs within parentheses().

		string searchString(string, char, char);
			// Function called by addSubtract() and multiplyDivide() to search
			// a string of input for operators: (+,-) or (*,/)
			// Once found, the arguements on both sides of the operator
			// are converted to doubles, the math operation is performed,
			// and the result is converted back to a string.
			// The unnecessary elements in the user-entered string are erased,
			// and the results of the operation are appended in their place.

		string searchString(string, char);
			// Overloaded instance of searchString() which is called by parentheses()
			// in order to find sets of parentheses and perform mathematical operations
			// on the data contained within them.

		string searchStringEx(string, char);
			// Function called by exponents() in order to find the exponent operator, ^,
			// and perform the required mathematical operation.

		string validateInput(string);
			// Function to determine if the user-input is valid.

		void begin();
			// Main menu of the program, which accepts the user input,
			// and repeats until the user exits the program.

		string removeSpaces(string);
			// Function to remove spaces from user input.

		bool isDouble(string);
			// Function to determine if the contents of a string
			// are numbers or a decimal point.

		bool error(string);
			// Function to display an error message if input is invalid
			// and return true if input is invalid.

		bool exit(string);
			// Function to display an exit message and return true
			// if input is EXIT.
};